const { defineConfig } = require('@vue/cli-service');
const Mock = require('mockjs')
const data = Mock.mock({
  "list|50": [{
    "image": "@image(120x180, @color)",
    "title": "@ctitle(10, 30)",
    "avatar": "@image(20x20, @color)",
    "nickname": "@cname",
    "zan|10-100": 1,
    "id": "@id"
  }],
  "love|50": [{
    "image": "@image(200x200, @color)",
    "title": "@ctitle",
    "content": "@cword(50, 100)",
    "like|10-20": 1,
    "message|10-20": 1,
    "avatar": "@image(20x20, @color)",
    "nickname": "@cname",
    "type|1-3": 1
  }]
})
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    setupMiddlewares(middlewares, { app }) {
      app.get('/list', (req, res) => {
        res.send(data.list)
      })

      app.get('/love', (req, res) => {
        res.send(data.love)
      })
      return middlewares  
    }
  }
})
